﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace STKMIS.DAL
{
    public class SqlDBParameter
    {
        //参数名称
        private string _name = null;
        //数据类型
        private DbType _dbType = DbType.String;
        //参数值
        private object _value = null;
        //参数类型(例如:输入,输出)
        private ParameterDirection _direction = ParameterDirection.Input;
        //参数长度
        private int _size = 0;

        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="name">参数名称</param>
        /// <param name="dbType">数据类型</param>
        /// <param name="direction">参数方向</param>
        /// <param name="size">数据最大宽度</param>
        public SqlDBParameter(string name, DbType dbType, ParameterDirection direction, int size)
        {
            _name = name;
            _dbType = dbType;
            _value = null;
            _size = size;
            _direction = direction;
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="name">参数名称</param>
        /// <param name="dbType">数据类型</param>
        /// <param name="value">参数值</param>
        public SqlDBParameter(string name, DbType dbType, object value)
        {
            _name = name;
            _dbType = dbType;
            _value = value;
            _direction = ParameterDirection.Input;
        }
       
        /// <summary>
        /// 参数长度
        /// </summary>
        public int Size
        {
            get
            {
                return _size;
            }
        }
        /// <summary>
        /// 数据类型
        /// </summary>
        public DbType DbType
        {
            get
            {
                return _dbType;
            }
        }
        /// <summary>
        /// 参数名称
        /// </summary>
        public string Name
        {
            get
            {
                return _name;
            }
        }

        /// <summary>
        /// 参数类型(例如:输入,输出)
        /// </summary>
        public ParameterDirection Direction
        {
            get
            {
                return _direction;
            }
        }

        /// <summary>
        /// 参数值(如果是输出参数则数据操作后为输出值)
        /// </summary>
        public object Value
        {
            get
            {
                return _value;
            }
            set
            {
                _value = value;
            }
        }
    }
}
